package com.zhiyou.app.common.util;

import com.xinchao.component.multids.bean.GeneratorParam;
import com.xinchao.component.multids.util.MyBatisCodeGeneratorSupport;
import com.zhiyou.app.mapper.BaseMapper;
import com.zhiyou.app.pojo.entity.BaseEntity;


/**
 * @author jonathan.z
 */
public class MapperGenerator {
    public static void main(String[] args) {
        new MyBatisCodeGeneratorSupport().generateCode(new GeneratorParam()
                        //作者
                        .setAuthorName("jonathan.z")
                        //模块名称，如果设置了模块名称，service\controller\mapper等都会创建对应的子模块
//                        .setModuleName("")
                        //controller包路径
                        .setControllerPackageName("controller")
                        //service包路径
                        .setServicePackageName("service")
                        //serviceImpl包路径
                        .setServiceImplPackageName("service.impl")
                        //mapper包路径
                        .setMapperPackageName("mapper")
                        //mapper xml 路径
                        .setMapperXmlPath("mapper/zy")
                        //相对工程路径
                        .setRelatedProjectPath("/")
                        //公共父包名
                        .setParentPackageName("com.zhiyou.app")
                        //父类设置
//                        .setControllerSupperClass(null)
//                        .setServiceSupperClass(null)
//                        .setServiceImplPackageName(null)
//                        .setMapperSupperClass(null)
                        .setMapperSupperClass(BaseMapper.class)
                        .setEntitySupperClass(BaseEntity.class)
                        .setEntitySuffix("Entity")
                        .setEntityPackageName("pojo.entity")
//                        .setSupperEntityColumns(new String[]{"id", "created_time", "updated_time", "deleted"})
                        //数据库设置
                        .setDataSourceDriverName("com.mysql.jdbc.Driver")
                        .setDataSourceUrl("jdbc:mysql://47.109.157.216:13306/idphoto?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&autoReconnect=true&useSSL=false&allowMultiQueries=true")
                        .setDataSourceUsername("root")
                        .setDataSourcePassword("Zyzz123456")
//                        .setDataSourceUrl("jdbc:mysql://192.168.83.239:3306/puma_ucenter?zeroDateTimeBehavior=convertToNull&useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&autoReconnect=true&rewriteBatchedStatements=true")
//                        .setDataSourceUsername("puma_ucenter")
//                        .setDataSourcePassword("pn7*PZCKsEa~T5bx")
                        //表名前缀
                        .setTableNamePrefix("zy_")
                        //设置lombok
                        .setAddEntityLombokModel(true),
                //自动生成的表名，数组可传入多个
//                "zy_app",
//                "zy_app_type",
//                "zy_com_wallet",
//                "zy_order",
//                "zy_task",
//                "zy_order_goods",
//                "zy_goods",
//                "zy_withdrawal_history"
                "id_addon_rule",
                "id_gift_rule"
//                "zy_user_wallet",
//                "zy_wallet_history",
//                "zy_wechat_pay_history"
        );
    }
}
